﻿@inherits AdminCompontentBase
@page "/channels/channelManagement"

<PageTitle>@T("Permission.ChannelManagement")</PageTitle>
<AutoHeight Overflow="_entities.Result.Any()" AutoClass="mt-6">
    <HeaderContent>
        <SSearchPanel @bind-Value="@_queryParam.Filter" OnEnter="RefreshAsync" OnClearClick="HandleClearAsync" OnClick="()=> _createModal.OpenModalAsync()">
            <ChildContent>
                <DefaultTitle>@T("Title")</DefaultTitle>
            </ChildContent>
        </SSearchPanel>
    </HeaderContent>
    <AutoHeightContent>
        @if (_entities.Result.Any())
        {
            <div class="grid-card">
                @foreach (var _entitie in _entities.Result)
                {
                    <div class="item">
                        <ChannelCard Channel="_entitie" OnEditClick="async()=>await _editModal.OpenModalAsync(_entitie)" />
                    </div>
                }
            </div>
        }
        else
        {
            <SEmptyPlaceholder />
        } 
    </AutoHeightContent>
</AutoHeight>

<ChannelEditModal @ref="_editModal" OnOk="HandleOk" />
<ChannelCreateModal @ref="_createModal" OnOk="HandleOk" />